#!/usr/bin/python
# -*- coding: UTF-8 -*-

from kpautos.engine.case import Case
from kptest.config.enum import DeviceType, HostType, DeviceUtility
from extension.test_logic.FileTransport import sftp_stream_copy
from datetime import datetime
import time


class IPMCSET_SOL_001(Case):
    """
            Name:
                IPMCSET_SOL_001
            Label:
                建立SOL会话
            PreCondition:
                BMC正常启动
            TestStep:
                1) 命令行执行 ipmcset -t sol -d activate -v 1 0
            ExpectedResult:
                A) 命令下发成功，能够进入到系统串口下
            Parameters:

            Author:
                baixin liuya
            Last Modified:

            Remark:

        """

    # 测试执行前配置等准备操作
    def pre_test_case(self):
        self.logger.info("Pre Test Case Start.... ")
        self.device_dut = self.resource.get_device(device_type=DeviceType.Server, utility=DeviceUtility.DUT)
        self.bmc_host = self.device_dut.get_host(host_type=HostType.BMC)

    # 测试步骤
    def procedure(self):
        self.log_step("Step1: ")
        resp = self.bmc_host.run({"command": ["ipmcget -d ipinfo"], "timeout": 10})
        self.logger.info(resp)


    # 测试结束后恢复环境
    def post_test_case(self):
        pass